#include<iostream>
#include<climits>
using namespace std;

int main()
{
    string s1, s2;
    cin >> s1 >> s2;

    int i = 0, j = 0, len = 0, ans = 0;
    while (i < s1.size())
    {
        if (s1[i] == s2[j])
        {
            ++len;
            ++i;
            ++j;
        }
        else
        {
            ans = max(ans, len);
            len = 0;
            j = 0;
        }
    }
    if (len != 0)
        ans = max(ans, len);
    cout << ans << endl;
    return 0;
}